package org.example.dao;

import org.apache.ibatis.annotations.*;
import org.example.entity.Grade;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface GradeDao{


    //根据用户名查询，查询跟参数相同的用户名 返回一个用户
    @Select("select * from grade where `gradeName` = #{gradeName}")
    Grade findByGradename(@Param("userName") String gradeName);


    @Select("select * from grade where `id` = #{id}")
    Grade findById(@Param("id")Integer id);


    List<Grade> findBySearch(@Param("search") Grade search);


    List<Grade> selectAll();

    @Insert("INSERT INTO grade (gradeName,brief) VALUES(#{gradeName},#{brief})")
    void insertSelective(Grade grade);

    @Delete("DELETE FROM grade WHERE id = #{id}")
    void deleteByPrimaryKey(Integer id);

     @Update("UPDATE grade SET gradeName=#{gradeName}, brief=#{brief} WHERE id=#{id}")
    void updateByPrimaryKeySelective(Grade grade);
}